<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>二维码管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					$("#btnSubmit").attr("disabled",true).removeClass("btn-primary");
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
		});
		
		var ids =[];
		var type;
		var groupId;
		 function saveLeader(){
			 type=$('#type').val();
			 groupId=$("#groupId").val();
			 $('input[name="ids"]:checked').each(function(){    
				   ids.push($(this).val());    
				  }); 
			 window.location.href="${ctx}/app/mmsGroup/saveGroupQrcode?ids="+ids+"&"+"type="+type+"&"+"groupId="+groupId;
		 }	
		
		
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/app/mmsGroup/list">组列表</a></li>
		<li><a href="${ctx}/app/mmsGroup/addQrcode?groupId=${groupId }&activeId=${activeId }">二维码列表</a></li>
		<li class="active"><a href="${ctx}/app/mmsGroup/addQrcodeToGroup?groupId=${groupId }&activeId=${activeId }">二维码添加</a></li>
	</ul><br/>
	<%-- <form action="" id="searchForm">
		<input id="mProvinID" name="provinId" type="hidden">
		<input id="id" name="id" type="hidden" value="${id}">
	</form> --%>
	<form:form id="searchForm" modelAttribute="mmsGroup" action="${ctx}/app/mmsGroup/list" method="post" class="breadcrumb form-search ">
		<%-- <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/> --%>
		<ul class="ul-form">
			<%-- <li><label>ID：</label><form:input path="id" maxlength="50" class="input-medium"/></li> --%>
			<%-- <li><label>组名称：</label><form:input path="name" maxlength="50" class="input-medium"/></li>
			<li><label>活动名称：</label><form:input path="id" htmlEscape="false" maxlength="50" class="input-medium"/></li> --%>
			<!-- <li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" onclick="return page();"/> -->
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr><th class="sort-column id">ID</th><th class="sort-column name">二维码类型</th><th>二维码号段</th><th>二维码链接</th></tr></thead>
		<tbody>
		<c:forEach items="${noGroupQrcodeList}" var="qrcode">
		<input type="hidden" name="type" id="type" value="${type}"/>
		<input type="hidden" name="groupId" id="groupId" value="${groupId}"/>
			<tr>
			<td><input type="checkbox" name="ids" id="suerId" value="${qrcode.id }"/>${qrcode.id }</td>
				<td>${qrcode.qrcodeType eq '0'?'书':'宣传单页'}</td>
				<td>${qrcode.beginNum}-${qrcode.endNum}</td>
				<td>${qrcode.qrcodeUrl}</td>
				<%-- <td>
    				<a href="${ctx}/mms/qrcode/form?id=${qrcode.id}">修改</a>
					<a href="${ctx}/mms/qrcode/delete?id=${qrcode.id}" onclick="return confirmx('确认要删除该用户吗？', this.href)">删除</a>
				</td> --%>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="form-actions">
			<button  onclick="saveLeader()">保存二维码</button>
	</div>
</body>
</html>